require 'rubygems'
require 'json'
require 'net/http'
require 'yaml'

def get_users
   base_url = "http://localhost:3000"
   url = "#{base_url}/users.json"
   resp = Net::HTTP.get_response(URI.parse(url))
   data = resp.body

   # convert JSON to Ruby
   result = JSON.parse(data)

   return result
end

# listing users
users = get_users
puts users.map.to_yaml